VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsAuthPassSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
Public Function PerformAuthSearch(ByVal strUserName As String, ByVal sSQLUsers As String) As String

Dim strSQL As String
Dim strIAm As String
Dim strIWantTO As String
Dim strCanYN As String

Call modGeneral.dbConnect
    
Dim rsHasRights As ADODB.Recordset
Set rsHasRights = New ADODB.Recordset

'the cursor must support bookmarks for us to use the pageing functionallity
rsHasRights.CursorType = adOpenStatic
rsHasRights.CursorLocation = adUseClient


'load the users access rights for the anchor
strSQL = "select use_id from dir_users where username = '" & strUserName & "'"
rsHasRights.Open strSQL, obj_ADOConn, adOpenStatic, adLockOptimistic
strIAm = rsHasRights("use_id")
rsHasRights.Close

'strSQL = "select use_id from dir_contact_details where contact_name ='" & CStr(rsRequestList("req_by")) & "'"
'rsHasRights.Open strSQL, obj_ADOConn, adOpenStatic, adLockOptimistic
'strIWantTO = rsHasRights("use_id")
'rsHasRights.Close

'strSQL = "select use_id from dir_users where use_id = '" & strIAmId & "'"
'rsHasRights.Open strSQL, obj_ADOConn
'strIWantTO = rsHasRights("use_id")

strIWantTO = sSQLUsers


strSQL = "exec dir_check_load_user " & strIAm & "," & strIWantTO
rsHasRights.Open strSQL, obj_ADOConn
strCanYN = rsHasRights("see_user")
rsHasRights.Close

'the user can see requests that they loaded as well as requestes loaded
'by users who are their subordinates
If strCanYN = "Y" Then
    PerformAuthSearch = "Y"
Else
    PerformAuthSearch = "N"
End If

End Function
